<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let arr =[11,22,[3,44,[55,66]]]
    console.log('es6 fill',arr.flat(Infinity));
    function myflat(arr){
        let arr1=[]
        for(var v of arr){
            if(Array.isArray(v)){
                arr1.push.apply(arr1,myflat(v))
            }else{
                arr1.push(v)
            }
        }
        return arr1
    }
    console.log(myflat(arr));
</script>
</html>